Yes.
concat()
Method The parts of the statement match the documentation correctly:
String name = first.concat( last ); ----+---- --+-- --+-- --+-- | | | | | | | | | | | +---- a String reference parameter | | | | | +----- the name of the method | | | +----- dot notation used to call an object's method. | +----- the method returns a reference to a new String object
The concat
method performs string concatenation.
A new String is constructed
using the data from two other Strings.
In the example,
the first two strings
(referenced by first
and last
)
supply the data that concat()
uses to construct a
third string
(referenced by name
.)
String first = "Dempster " ; String last = "Dumpster" ; String name = first.concat( last );
The first two Strings are NOT changed by the action of concat()
.
A new string is constructed that contains the results of
the action we wanted.